{% extends "StartGroup/groupHome.html" %}
{% block portraitUpload %}{% endblock %}
{% block view_poll %}
    <div class="pollsPortal">
        {% if permission == "Owner" or permission == "Board Member" or permission == "Assistant Board Member" %}
            <div class="createPollLink"><a href="/connectpeople/{{ group.group_web_address }}/polls/add/">Create New Poll</a></div>
        {% endif %}
        <div class='pollsResultSection'>
            {% if poll_pages.object_list %}
                <table class='PollDetail' width="65%">
                    <div class='PollHeader'>
                        <div class="pollResultsHeader">
                                <div class="pollResultHeaderTopic nobreak">Poll</div>
                                <div class="pollResultHeaderDate nobreak">Started</div>
                                <div class="pollResultHeaderVoting nobreak">Response</div>
                        </div>
                    </div>
                    {% for each in poll_pages.object_list %}
                    <div class="eachPollSingleLine">                            
                        <div class="pollResultHeaderTopic nobreak">{{ each.0.poll_topic }}
                        {% if permission != 'Non Member' %}
                            <a href="{{ each.0.id }}/vote">Vote!</a>
                        {% endif %}
                        </div>
                        
                        <div class="pollResultHeaderDate nobreak">{{ each.0.pub_date }}</div>
                        <div class="HeaderVoting nobreak">
                            <div><a resultid="{{each.0.id}}" class="numResultClass" href="#" >{{ each.1 }} so far</a></div>
                        </div>
                    </div>
                    <div id="{{each.0.id}}" class="pollVotingHoverSection" style="display: none;">
                        <div class="votingResultGraphSection">
                            {% if each.2 %}
                                {% for options in each.2 %}
                                    <div class="clearbreak">
                                        <div>{{ options.0 }}</div>
                                        <div>
                                            <div class="votingresultImg nobreak"><img src="/site_media//images/line-img.gif" height="10" width="{% widthratio options.1 each.1 160 %}" /></div>
                                            <div class="nobreak">{{options.1}} out of {{each.1}}</div>
                                        </div>
                                    </div>
                                {% endfor %}
                            {% else %}
                                no choices !!
                            {% endif %}
                        </div>
                    </div>
                    {% endfor %}
                </table>        
            {% else %}
            <div class="PollPages">
                {% if poll_pages.has_previous %}
                    <a href="?page={{ pages.previous_page_number }}">previous</a>
                {% endif %}
            
                <span>
                    Page {{ poll_pages.number }} of {{ poll_pages.paginator.num_pages }}
                </span>
            
                {% if poll_pages.has_next %}
                    <a href="?page={{ pages.next_page_number }}">next</a>
                {% endif %}
            </div>
                <p>No polls are available.</p>
            {% endif %}
        </div>
    </div>
    
    <script src="/{{ media_url }}contifyuser/js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
	$(document).ready(function(){$("a.numResultClass").hover(
            function () {
                var resultid = $(this).attr("resultid");
                id = "#" + resultid;
                $(id).show();
              }, 
              function () {
                var resultid = $(this).attr("resultid");
                id = "#" + resultid;
                $(id).hide();
              }
            );
	});

    </script>
{% endblock %}
{% block content %}{% endblock %}
{% block extrajs %}

{%endblock%}
